package com.huawei.appgallery.wishlist.ui.fragment;

import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.foundation.ui.framework.fragment.AppListFragment;
import com.huawei.appgallery.wishlist.ui.cardkit.bean.WishBaseInfoCardBean;
import com.huawei.appgallery.wishlist.ui.fragment.WishDetailFragmentProtocol.Request;
import com.huawei.appgallery.wishwall.ui.activity.WishWallDetailActivityProtocol;
import com.huawei.secure.android.common.intent.SafeBroadcastReceiver;
import o.cfv;
import o.cgi;
import o.cih;
import o.cjo;
import o.ContentManager;
import o.fho;
import o.fiu;
import o.fjb;
import o.ll;

public class WishDetailFragment extends AppListFragment<WishDetailFragmentProtocol> {
    private b ˊ;
    private WishBaseInfoCardBean ᐝ;

    final class b extends SafeBroadcastReceiver {
        final /* synthetic */ WishDetailFragment ˎ;

        private b(WishDetailFragment wishDetailFragment) {
            this.ˎ = wishDetailFragment;
        }

        public void onReceiveMsg(Context context, Intent intent) {
            int i = 0;
            int i2 = 1;
            String action = intent.getAction();
            if (action != null && this.ˎ.ᐝ != null && action.contentEquals("action_local_brd_reply_state")) {
                int intExtra = intent.getIntExtra("reply_state", 0);
                if (this.ˎ.ᐝ.ʼ() == 1) {
                    this.ˎ.ᐝ.ॱ(2);
                    i = 1;
                }
                if (intExtra == 1) {
                    if (this.ˎ.ᐝ.ʼ() != 0) {
                        this.ˎ.ᐝ.ॱ(3);
                    }
                    i2 = i;
                } else {
                    if (intExtra == 2 && this.ˎ.ᐝ.ʼ() == 3) {
                        this.ˎ.ᐝ.ॱ(2);
                    }
                    i2 = i;
                }
                if (i2 != 0) {
                    this.ˎ.י.ͺ();
                }
            }
        }
    }

    public void ˏ(Bundle bundle) {
        super.ˏ(bundle);
        this.ˊ = new b();
    }

    public void ᐝʼ() {
        super.ᐝʼ();
        cjo ˆ = ˆ();
        if (ˆ instanceof WishDetailFragmentProtocol) {
            this.ʼˊ = ((Request) ((WishDetailFragmentProtocol) ˆ).ॱ()).ˋᐝ();
        }
    }

    public cfv ˏ(String str, String str2, int i) {
        return cgi.ˏ(str, str2, i);
    }

    public boolean ˊ(TaskFragment taskFragment, com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment.b bVar) {
        return super.ˊ(taskFragment, bVar);
    }

    public void ˏ(int i, cih o_cih) {
        super.ˏ(i, o_cih);
        if (i == 10009) {
            CardBean ˌ = o_cih.ˌ();
            if (ˌ instanceof WishBaseInfoCardBean) {
                WishBaseInfoCardBean wishBaseInfoCardBean = (WishBaseInfoCardBean) ˌ;
                this.ᐝ = wishBaseInfoCardBean;
                ˊ(wishBaseInfoCardBean);
            }
        }
    }

    private void ˊ(WishBaseInfoCardBean wishBaseInfoCardBean) {
        fjb ˎ = fho.ˏ().ˋ("WishWall").ˎ("wishwall.detail.activity");
        WishWallDetailActivityProtocol wishWallDetailActivityProtocol = (WishWallDetailActivityProtocol) ˎ.ˊ();
        WishWallDetailActivityProtocol.Request request = new WishWallDetailActivityProtocol.Request();
        request.ˊ(wishBaseInfoCardBean.ॱॱ());
        wishWallDetailActivityProtocol.ॱ(request);
        fiu.ˊ().ˏ(ॱˊ(), ˎ);
    }

    public void ˌॱ() {
        super.ˌॱ();
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("action_local_brd_reply_state");
        ll.ˏ(ContentManager.getInstant().getContext()).ˏ(this.ˊ, intentFilter);
    }

    public void ˋʼ() {
        super.ˋʼ();
        if (this.ˊ != null) {
            ll.ˏ(ContentManager.getInstant().getContext()).ˋ(this.ˊ);
        }
    }
}
